<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
        <style>
            *{
                padding:0px;
                margin:0px;
                list-style:none;
            }
            div{
                margin:30px 730px;
                position: relative;
                width: 730px;
                
                height: 300px;
            }
            ul{
                width: 9999px;
                position: relative;
                left:0px;
            }
            ul li{
                float: left;
            }
            .list{
                position: absolute;
                bottom:0px;
                left:50%;
               transform: translateX(-50%);
            }
            ol li{
                margin:0px 4px;
                width:10px;
                height: 10px;
                border-radius: 50%;
                background:white;
                float: left; 
                cursor: pointer;
            }
            span{
                position: absolute;
                top:50%;
                transform: translateY(-50%);
                background:rgba(51, 56, 58, 0.514);
                cursor: pointer;
            }
            .left{
                left:10px;
               font-size:30px;
               color: rgba(204, 208, 216, 0.76);
            }
            .right{
                right: 10px;
                font-size:30px;
                color: rgba(204, 208, 216, 0.76);
            }
            .current{
                background: #f60;
            }
            body{
                background:cornflowerblue;
            }

        </style>
    </head>
    <body>
        <div id="wrap">
            <ul id="box">
                <li><img src="images/1.jpg" alt=""></li>
                <li><img src="images/2.jpg" alt=""></li>
                <li><img src="images/3.jpg" alt=""></li>
                <li><img src="images/4.jpg" alt=""></li>
                <li><img src="images/5.jpg" alt=""></li>
                <li><img src="images/6.jpg" alt=""></li>
            </ul>
            
            <ol id="list">     
                <li class="current"></li>
                <li></li>
                <li></li>
                <li></li>
                <li></li>
                <li></li>
            </ol>
    
            <span class="left" id="left">⊂</span>
            <span class="right" id="right">⊃</span>
      
        <script>
            var num =0;
            var list=document.getElementById('list').children;
            var left=document.getElementById('left');
            var right=document.getElementById('right');
            var box=document.getElementById('box');
            var wrap=document.getElementById('wrap');
            var timer;
            function fn(){
               timer=setInterval(function(){
                    num--;
                        if(num<-6){
                            num=0
                        }
                        
                        for(var i=0;i<list.length;i++){
                            list[i].className='';
                        }
                        list[-num].className='current';
                        box.style.left=730*num+'px';
                },1000)
            }
            fn()
               
                wrap.onmouseenter=function(){
                    clearInterval(timer)
                }
                wrap.onmouseleave=function(){
                    fn()
                }
                for(var i=0;i<list.length;i++){
                list[i].index=i;
                    list[i].onclick=function(){
                        for(var n=0;n<list.length;n++){
                            list[n].className=''
                        }
                        this.className='current';
                        var m=this.index;
                        num=-m;
                        box.style.left=730*num+'px';
                    }
                }
                
                right.onclick=function(){
                        num--;
                        if(num<-6){
                            num=0
                        }
                        for(var i=0;i<list.length;i++){
                            list[i].className='';
                        }
                        list[-num].className='current';
                        box.style.left=730*num+'px'; 
                }
                left.onclick=function(){
                        num++;
                        if(num>0){
                            num=-6
                        }
                        
                        for(var i=0;i<list.length;i++){
                            list[i].className='';
                        }
                       
                        list[-num].className='current';
                        box.style.left=730*num+'px'; }

        </script>
        </div>
    </body>
    </html>